import scrapy


class TcSpider(scrapy.Spider):
    name = "tc"
    allowed_domains = ["cn.58.com"]
    start_urls = ["https://cn.58.com/sou/?key=%E5%89%8D%E7%AB%AF%E5%BC%80%E5%8F%91"]

    def parse(self, response):
        # content = response.body  # 响应的是二进制文件
        # content = response.text  # 响应的是字符串
        # print(content)
        span = response.xpath('//div[@id=filter]/div[@class="tabs"]/a/span')[0]   # 响应的是selector列表
        print(span.extract())  # 提取的是selector对象的data
        print(span.extract_first())
        print("==================")
        print('安徽哈哈哈哈哈哈')
